package com.lxy.cloud.mqtt.client.constant.enums;

/**
 * @Author: lxy
 * @Date: 2020/9/7 10:37
 * @Desc: 处理类跟topic中[事件名||方法名]的对应关系
 */
public enum ProcessBeanEnum {
    /**
     * 物流数据上传
     */
    A2FILE_NOTIFY("A2FILE_NOTIFY", "FOTA_PostVersionActiveNotifier"),
    LOGISTICS_DATA_UPLOAD("LOGISTICS_DATA_UPLOAD", "FOTA_VehicleInfoEvent"),
    USER_LOGIN("USER_LOGIN", "LOGIN_FOTATOBReq"),
    COMMON_REPLY("COMMON_REPLY", "COMMON_REPLY"),
    ;

    private String beanName;
    private String eventName;

    ProcessBeanEnum(String beanName, String eventName) {
        this.beanName = beanName;
        this.eventName = eventName;
    }

    public static String getBeanNameByEventName(String eventName) {
        for (ProcessBeanEnum e : ProcessBeanEnum.values()) {
            if (e.eventName.equals(eventName)) {
                return e.getBeanName();
            }
        }
        return null;
    }

    public String getBeanName() {
        return beanName;
    }

    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    public String getEventName() {
        return eventName;
    }

    public void setEventName(String eventName) {
        this.eventName = eventName;
    }
}
